<?php

/**
 * modulo filter form base class.
 *
 * @package    sistema_itec_new
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BasemoduloFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'nombre'              => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'etiqueta'            => new sfWidgetFormFilterInput(),
      'observaciones'       => new sfWidgetFormFilterInput(),
      'identificador'       => new sfWidgetFormFilterInput(),
      'ubicacion_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Ubicacion'), 'add_empty' => true)),
      'unidad_formacion_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('UnidadFormacion'), 'add_empty' => true)),
      'estado_id'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Estado'), 'add_empty' => true)),
      'regimen_id'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Regimen'), 'add_empty' => true)),
      'modalidad_id'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Modalidad'), 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'nombre'              => new sfValidatorPass(array('required' => false)),
      'etiqueta'            => new sfValidatorPass(array('required' => false)),
      'observaciones'       => new sfValidatorPass(array('required' => false)),
      'identificador'       => new sfValidatorPass(array('required' => false)),
      'ubicacion_id'        => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Ubicacion'), 'column' => 'id')),
      'unidad_formacion_id' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('UnidadFormacion'), 'column' => 'id')),
      'estado_id'           => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Estado'), 'column' => 'id')),
      'regimen_id'          => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Regimen'), 'column' => 'id')),
      'modalidad_id'        => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Modalidad'), 'column' => 'id')),
    ));

    $this->widgetSchema->setNameFormat('modulo_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'modulo';
  }

  public function getFields()
  {
    return array(
      'id'                  => 'Number',
      'nombre'              => 'Text',
      'etiqueta'            => 'Text',
      'observaciones'       => 'Text',
      'identificador'       => 'Text',
      'ubicacion_id'        => 'ForeignKey',
      'unidad_formacion_id' => 'ForeignKey',
      'estado_id'           => 'ForeignKey',
      'regimen_id'          => 'ForeignKey',
      'modalidad_id'        => 'ForeignKey',
    );
  }
}
